package com.bjx.flow.mmx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bjx.flow.mmx.domain.entity.MmxFlowTaskEntity;
import com.bjx.flow.mmx.mapper.MmxFlowTaskMapper;
import com.bjx.flow.mmx.service.MmxFlowTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @desc: 流程任务服务实现
 * @author: liushuai
 * @date: 2023/05/22
 */
@Service
public class MmxFlowTaskServiceImpl extends ServiceImpl<MmxFlowTaskMapper, MmxFlowTaskEntity> implements MmxFlowTaskService {
    @Autowired
    private MmxFlowTaskMapper flowTaskMapper;


    @Override
    public void insertFlowTaskBatch(List<MmxFlowTaskEntity> tasks) {
        this.saveBatch(tasks);
    }

    @Override
    public void deleteTaskByNodeId(String id) {
        LambdaQueryWrapper<MmxFlowTaskEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(MmxFlowTaskEntity::getNodeId, id);
        this.remove(wrapper);
    }

    @Override
    public MmxFlowTaskEntity selectTaskByTaskId(Long taskId) {
        return flowTaskMapper.selectById(taskId);
    }


}
